package com.mybatisx.mybatisplus.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
//spring的两步骤
//1.找对象
//2.放到spring中待用
//3.如果是springboot 就先分析源码
@Configuration  //相当于xml文件 r
public class ElasticSearchClientConfig {
    // spring <beans id = restHighLevelClient class = RestHighLevelClient>
    @Bean("restHighLevelClient")
    public RestHighLevelClient restHighLevelClient(){
        RestHighLevelClient client = new RestHighLevelClient(
                RestClient.builder(
                        new HttpHost("192.168.200.128", 9200, "http")));
        return client;
    }
}
